package com.qf.controller;

import com.qf.dto.R;
import com.qf.events.MenuChangeEvent;
import com.qf.service.MenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/*
杨威
2022/1/9
18:11
*/
@RestController
@RequestMapping("/menu")
public class MenuController {
    @Autowired
    private MenuService menuService;
    @Autowired
    ApplicationContext ac;
    @RequestMapping("/updateStatus")
    R updateInterfaceStatus(Long enable, Long menuId){
        menuService.updateInterfaceStatus(enable,menuId);
        ac.publishEvent(new MenuChangeEvent());
        return R.setOk();
    }
}
